﻿<%@ Page Language="C#" MasterPageFile="../MasterPage.master" AutoEventWireup="true" CodeFile="congxa.aspx.cs" Inherits="Doanhnghiep_congxa" Title="QUAN LY MOI TRUONG" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

 
            
         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            
            <script type="text/javascript">
            
          
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            function showHideForm()
                               {
                                    var imgShowHide = document.getElementById("imgShowHide");
                                    var divNhapLieu = document.getElementById("divNhapLieu");
                                    var tblTimKiem = document.getElementById("tblTimKiem");
                                    if(isShow)
                                    {
                                        isShow = false;                           
                                        myHeight = divNhapLieu.style.height;
                                        divNhapLieu.style.height = "25px";
                                        imgShowHide.src = "../images/qsfConfigUpArrow.png";
                                        tblTimKiem.style.visibility = "hidden";
                                    }else
                                    {
                                        isShow = true;
                                        var imgShowHide = document.getElementById("imgShowHide");
                                        var divNhapLieu = document.getElementById("divNhapLieu");
                                        divNhapLieu.style.height = myHeight;
                                        imgShowHide.src = "../images/qsfConfigDownArrow.png";
                                        tblTimKiem.style.visibility = "visible";
                                    }
                               }                   
            </script>

        </telerik:RadCodeBlock>
        <br />
 <fieldset id="divNhapLieu" style="width:500px;">
<legend style="margin-left:30px;"><span style="color: #666633; font-family: Verdana"><strong>
Tìm kiếm</strong></span></legend>
<table cellpadding="2" cellspacing="1"  id="tblTimKiem">
<tr style="height: 19px;">
		<td style="width: 151px"><span style="font-size: 9pt; color: #000000;margin-left:20px;">
		    Tên cống</span>
    </td>
        <td style="width: 369px"><span style="margin-left:50px;">
            <telerik:RadTextBox ID="txtTen" runat="server">
            </telerik:RadTextBox></span>
           
        </td>
</tr>


<tr style="height: 19px;">
		<td style="width: 146px"><span style="font-size: 9pt; color: #000000;margin-left:20px">
		    Khu công nghiệp</span>
    </td>
        <td style="width: 369px"><span style="margin-left:50px;">
            <telerik:RadComboBox ID="RadComboBox_kcn" runat="server" DataSourceID="Congxa_kcn" AllowCustomText="true"
            DataTextField="TenKCN" DataValueField="Makcn" MarkFirstMatch="true" EnableLoadOnDemand="true" HighlightTemplatedItems="true">
            </telerik:RadComboBox></span>        
    </td>
</tr>
<tr style="height: 19px;">
		<td style="width: 146px"><span style="font-size: 9pt; color: #000000;margin-left:20px;">
		    Doanh nghiệp</span>
    </td>
        <td style="width: 369px"><span style="margin-left:50px;">
              <telerik:RadComboBox ID="RadComboBox_dn" runat="server" DataSourceID="Congxa_dn" 
              DataTextField="TenDN" DataValueField="Madnghiep" AllowCustomText="true">
            </telerik:RadComboBox> </span>      
    </td>
</tr>
		<tr>
            <td  colspan="2" align="center">
                <table width="100%"><tr><td style="height: 25px"><span style="font-size: 9pt; color: #000000;margin-left:20px;">
                <telerik:RadButton ID="RadButton1" runat="server" Text="Tìm kiếm" Skin="Hay" OnClick="Button1_Click">
                    </telerik:RadButton></span> </td>
                </tr></table>
      </td></tr>
    </table>
</fieldset>

        
        
            <p id="divMsgs" runat="server">
        <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>
            </p>
      
         <!-- load ajax-->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid_congxa">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid_congxa" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="divMsgs" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <!-- end-->
        
        
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
            BackColor="#99FF66" Skin="WebBlue" />
        <telerik:RadGrid ID="RadGrid_congxa" runat="server" AllowPaging="True" 
            AllowSorting="True" CellSpacing="0" DataSourceID="SqlDataSource_Congxa" 
            GridLines="None" AllowAutomaticDeletes="True" AutoGenerateColumns="False"
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnItemUpdated="RadGrid_congxa_ItemUpdated"
             
           OnItemInserted="RadGrid_congxa_ItemInserted" OnDataBound="RadGrid_congxa_DataBound" Skin="Telerik">
                <HeaderContextMenu></HeaderContextMenu>

                <MasterTableView AutoGenerateColumns="False" DataKeyNames="Macong" 
                                DataSourceID="SqlDataSource_Congxa" CommandItemDisplay="Top">
                                
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>

                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>

    <Columns>
    
    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>
                    
        <telerik:GridBoundColumn DataField="Macong" DataType="System.Int32"  Visible="false"
            FilterControlAltText="Filter Macong column" HeaderText="Macong" ReadOnly="True" 
            SortExpression="Macong" UniqueName="Macong">
        </telerik:GridBoundColumn>
        
           <telerik:GridTemplateColumn HeaderText="STT">
                       <ItemTemplate>
                        <asp:Label runat="server" ID="lblSTT" Text='<%#i++%>'></asp:Label>
                       </ItemTemplate>
           </telerik:GridTemplateColumn>        
       
        <telerik:GridDropDownColumn DataField="Madnghiep" DataSourceID="Congxa_dn"
                        HeaderText="Doanhnghiep" ListTextField="TenDN" ListValueField="Madnghiep"
                        UniqueName="Madnghiep" ColumnEditorID="GridDropDownColumnEditor1">
        </telerik:GridDropDownColumn>
        
         <telerik:GridDropDownColumn DataField="Makcn" DataSourceID="Congxa_kcn"
                        HeaderText="Khu công nghiệp" ListTextField="TenKCN" ListValueField="Makcn"
                        UniqueName="Makcn" ColumnEditorID="GridDropDownColumnEditor1">
        </telerik:GridDropDownColumn>
        <telerik:GridCheckBoxColumn DataField="ThuocKCN" DataType="System.Boolean" HeaderText="Thuộc KCN" 
        UniqueName="ThuocKCN" ColumnEditorID="check">
        </telerik:GridCheckBoxColumn>
        <telerik:GridBoundColumn DataField="Tencong" 
            FilterControlAltText="Filter Tencong column" HeaderText="Tencong" 
            SortExpression="Tencong" UniqueName="Tencong">
        </telerik:GridBoundColumn>
        <telerik:GridNumericColumn DataField="ToadoX" 
            FilterControlAltText="Filter ToadoX column" HeaderText="ToadoX" SortExpression="ToadoX" 
            UniqueName="ToadoX">
        </telerik:GridNumericColumn>
        <telerik:GridNumericColumn DataField="ToadoY" 
            FilterControlAltText="Filter ToadoY column" HeaderText="ToadoY" 
            SortExpression="ToadoY" UniqueName="ToadoY">
        </telerik:GridNumericColumn>
        <telerik:GridHTMLEditorColumn DataField="Ghichu"
            FilterControlAltText="Filter Ghichu column" HeaderText="Ghichu" 
            SortExpression="Ghichu" UniqueName="Ghichu" ColumnEditorID="Ghichu">
        </telerik:GridHTMLEditorColumn>
        
       
        
        <telerik:GridButtonColumn ConfirmText="Delete this Congxa?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
    </Columns>

         
           </MasterTableView>
           <ClientSettings EnableRowHoverStyle="true">
               <Selecting AllowRowSelect="True" />
               <ClientEvents OnRowDblClick="RowDblClick" />
           </ClientSettings>


<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource_Congxa" runat="server"
          ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" ProviderName="System.Data.SqlClient"
          SelectCommand="SELECT * FROM Congxa"
           DeleteCommand="DELETE FROM [Congxa] WHERE [Macong] = @original_Macong"
           InsertCommand="INSERT INTO Congxa(Madnghiep,Makcn, Tencong,ToadoX,ToadoY,Ghichu,ThuocKCN) VALUES (@Madnghiep,@Makcn,@Tencong,@ToadoX,@ToadoY,@Ghichu,@ThuocKCN)"
           UpdateCommand="UPDATE [Congxa] SET [Madnghiep] = @Madnghiep,[Makcn]=@Makcn, [Tencong] = @Tencong, [ToadoX] = @ToadoX, [ToadoY] = @ToadoY,[Ghichu]=@Ghichu,[ThuocKCN]=@ThuocKCN WHERE [Macong] = @original_Macong"
           
          OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
         
          
          <DeleteParameters>
               <asp:Parameter Name="original_Macong" Type="Int32" />
           </DeleteParameters>
           <UpdateParameters>
               <asp:Parameter Name="Madnghiep" Type="Int32" />
               <asp:Parameter Name="Makcn" Type="Int32" />
               <asp:Parameter Name="Tencong" Type="String" />
               <asp:Parameter Name="ToadoX" Type="String" />
               <asp:Parameter Name="ToadoY" Type="String" />
               <asp:Parameter Name="Ghichu" Type="String" />
                <asp:Parameter Name="ThuocKCN" Type="Boolean" />
               
               <asp:Parameter Name="original_Macong" Type="Int32" />
               
               
           </UpdateParameters>
           <InsertParameters>                
               
               <asp:Parameter Name="Madnghiep" Type="Int32" />
               <asp:Parameter Name="Makcn" Type="Int32" />
               <asp:Parameter Name="Tencong" Type="String" />
               <asp:Parameter Name="ToadoX" Type="String" />
               <asp:Parameter Name="ToadoY" Type="String" />
               <asp:Parameter Name="Ghichu" Type="String" />
               <asp:Parameter Name="ThuocKCN" Type="Boolean" />
              
           </InsertParameters>
          
      </asp:SqlDataSource>
        
        
         <asp:SqlDataSource ID="Congxa_dn" runat="server" 
           ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
           SelectCommand="SELECT TOP 20 * FROM [Doanhnghiep]">
         </asp:SqlDataSource>
         
             <asp:SqlDataSource ID="Congxa_kcn" runat="server" 
           ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
           SelectCommand="SELECT TOP 20 * FROM [Khucongnghiep]">
         </asp:SqlDataSource>
        
       <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="200px" />
       <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="150px" />
       <telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" DropDownStyle-Width="110px" />
       <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" />
       <telerik:GridHTMLEditorColumnEditor ID="Ghichu" runat="server" Editor-Width="100px" Editor-Height="100px">
       </telerik:GridHTMLEditorColumnEditor>

</asp:Content>

